package com.zh.note.huawei.twohundred.查字典;

import java.util.Scanner;

/**
 * https://dream.blog.csdn.net/article/details/131205201
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String preStr = sc.next();
        int n = sc.nextInt();
        String[] dir = new String[n];
        boolean flag = true;
        for (int i = 0; i < n; i++) {
            dir[i] = sc.next();
            if (dir[i].startsWith(preStr)) {
                System.out.println(dir[i]);
                flag = false;
            }
        }
        if (flag) {
            System.out.println(-1);
        }
    }
}
